package top.lingkang.securityoauth2.core.dto;

import java.io.Serializable;

/**
 * @author lingkang
 * Created by 2022/7/8
 */
public class Oauth2Response<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    private T data;

    public Oauth2Response success(String msg) {
        code = 0;
        this.msg = msg;
        return this;
    }

    public Oauth2Response success(String msg, T data) {
        code = 0;
        this.msg = msg;
        this.data = data;
        return this;
    }

    public Oauth2Response fail(String msg) {
        code = 1;
        this.msg = msg;
        return this;
    }

    public Oauth2Response fail(String msg, T data) {
        this.msg = msg;
        this.data = data;
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
